import { Body, Controller, Ip, Post, Req } from '@nestjs/common';
import { LoginService } from './login.service';
import { ResponseUtilService } from '@app/response-util';

@Controller('login')
export class LoginController {
    constructor(
        private service:LoginService,
    ){}
    
    @Post()
    async login(@Body('code') code:string, @Req() req:ReqAttrs, @Ip() ip:string) {
        const r =  await this.service.login(code, true)
        return r ? ResponseUtilService.successRes(r) : ResponseUtilService.failRes()
    }
}
